import java.util.Arrays;
import java.util.Scanner;

public class test{
//利用函数求最大值
/*public static void main(String[] args) {
    System.out.println(max2(6, 7));
    System.out.println(max3(6, 7, 8));

}
public static int max2( int a, int b){
    return a > b ? a : b;
}
public static int max3 (int a, int b, int c) {
    int e = max2(a , b);
    int f = max2(b , c);
    int g = max2(e , f);
    return g;
}*/
//求阶乘
/*public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int b = scanner.nextInt();;
    System.out.println(fac(b));
    System.out.println(fac(3));

}
public static int fac(int a) {
    int fac = 1;
    for (int i = 1; i <= a; i++) {
        fac *= i;
    }
    return fac;
}*/
//求阶乘的和
/*public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int b = scanner.nextInt();
    System.out.println(fac(b));
}
    public static int fac(int a) {
        int sum = 0;
        for ( int i = 0; i <= a; i--) {
            int fac = 1;
            for (int j = 1; j <= i; j++) {
                fac *= j;
            }
            sum += fac;
        }
        return sum;
    }*/
//用迭代求斐波那契数列的第n项
/*public static void main(String[] args) {
    int n = 5;
    System.out.println(fib(n));

}
public static int fib(int n){
    if(n == 0){
        return 0;
    }
    if (n == 1) {
        return 1;
    }
    int n1 = 0;
    int n2 = 1;
    int sum = 0;
    for (int i = 3; i <= n ; i++) {
        sum = n1 + n2;
        n1 = n2;
        n2 = sum;
    }
    return sum;
}*/
//求和的重载，两个整数的方法 和 三个小数之和的方法
/*public static void main(String[] args) {
    System.out.println(sum(1.0, 2.0, 3.0));
    System.out.println(sum(5, 10));

}
public static int sum(int a ,int b){
    return a + b;
}
public static double sum(double a ,double b ,double c){
    return a + b + c;
}*/
//求最大值方法的重载，要求不仅可以求2个整数的最大值，还可以求3个小数的最大值
/*public static void main(String[] args) {
    System.out.println(max(5, 10));
    System.out.println(max(5.0, 6.0, 7.0));

}
public static int max(int a , int b){
    return a>b? a:b;
}
public static double max(double a , double b , double c){
    if (a >= b && a >= c) {
        return a;
    } else if (b >= a && b >= c) {
        return b;
    } else {
        return c;
    }

}*/
//递归求一个数的阶乘
/*public static void main(String[] args) {
    System.out.println(fac(3));
}
public static int fac(int n){
    if(n == 1){
        return 1;
    }
    else {
        n *= fac(n-1);
    }
    return n;
}*/
//递归求斐波那契数列的第n项
/*public static void main(String[] args) {
    System.out.println(fab(3));

}
public static int fab(int n){
    if (n == 0) {
        return 0;
    }
    // 基本情况：当 n 为 1 时，斐波那契数列的值为 1
    else if (n == 1) {
        return 1;
    }
    // 递归情况：F(n) = F(n - 1) + F(n - 2)
    else {
        return fab(n - 1) + fab(n - 2);
    }

}*/
//实现一个方法 transform, 以数组为参数, 循环将数组中的每个元素 乘以 2 ,
//并设置到对应的数组元素上. 例如 原数组为 {1, 2, 3}, 修改之后为 {2, 4, 6}
/*public static void main(String[] args) {
    int[] a = {1 ,2 ,3};
    transform(a);
    System.out.println(Arrays.toString(a));
}
public static void transform( int[] n){
    for (int i = 0; i < n.length; i++) {
        n[i] = 2 * n[i];
    }
}*/

}


